﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using DTO;
namespace DAO
{
    public class KHACHSAN_THANHPHO_DAO
    {
        #region
        public static List<KHACHSAN_THANHPHO_DTO> SelectkssByAndMaTuyenDL(int MaTuyenDL)
        {
            List<KHACHSAN_THANHPHO_DTO> list = new List<KHACHSAN_THANHPHO_DTO>();
            try
            {
                // Create List Sql Parameter
                List<SqlParameter> sqlParams = new List<SqlParameter>();
                sqlParams.Add(new SqlParameter("@MaTuyenDL", MaTuyenDL));
                DataTable dt = SqlDataAccessHelper.ExecuteQuery("usp_SelectKHACH_SANsByAndMaTuyen", sqlParams);
                foreach (DataRow dr in dt.Rows)
                {
                    KHACHSAN_THANHPHO_DTO ks = new KHACHSAN_THANHPHO_DTO();
                    ks.MaKS = int.Parse(dr["MaKS"].ToString());
                    ks.TenKS = dr["TenKS"].ToString();
                    ks.TienPhong = float.Parse(dr["TienPhong"].ToString());
                    ks.TenTP = dr["TenTP"].ToString();
                    list.Add(ks);
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }
        #endregion
    }
}
